/* 
 * File:   Instance.h
 * Author: neuma173
 *
 * Created on March 30, 2011, 4:33 PM
 */

#ifndef _INSTANCE_H
#define	_INSTANCE_H
#include "Shape.h"
#include "TransformMatrix.h"


class Instance : public Shape {
public:
    Instance();
    Instance(Shape* shape);
    Instance(const Instance& orig);
    virtual ~Instance();
    void Rotate(double degrees, int axis);
    void Scale(double sx, double sy, double sz);
    void Translate(double dx, double dy, double dz);
    void Finalize(); //Does final calculations, such as computing inverse of TMatrix
                     //and building boundingBox
    //inherited methods from shape:
    bool TestIntersect(Ray &ray, double tmin, double tmax, HitStruct& hitStruct);
    const Vector3D SurfaceNormal(Ray &ray);
    double GetSortValue(int sortBy);
    void SetShader(Shader* shader);
    Shader* GetShader();
    
    TransformMatrix TMatrix;
    TransformMatrix ITMatrix;
private:
    
    Shape* shape;

};

#endif	/* _INSTANCE_H */

